package util.t;

import util.j.Shuchu;
import util.j.TiliListener;

import javax.swing.*;



public class MainWindows extends JFrame  {

    tiliList list=new tiliList();
    JLabel label1,label2;      //备注，体力
    JTextField textField1,textField2;    //备注，体力
    JButton button1,button2;    //下一个，输出
    JTextArea area;

    TiliListener listener;
    Shuchu shuchu;
    public MainWindows(){
        init();
        setVisible(true);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }

    private void init() {
        setLayout(null);
        label1=new JLabel("备注(名称):");
        label1.setBounds(20,20,100,30);
        label2=new JLabel("现有体力:");
        label2.setBounds(20,60,100,30);
        textField1=new JTextField();
        textField1.setBounds(90,20,200,30);
        textField2=new JTextField();
        textField2.setBounds(90,60,200,30);
        button1=new JButton("下一个");
        button1.setBounds(30,120,120,30);
        button2=new JButton("输出");
        button2.setBounds(200,120,80,30);
        area=new JTextArea();
        area.setBounds(30,170,270,500);

        add(label1);
        add(label2);
        add(textField1);
        add(textField2);
        add(button1);
        add(button2);
        add(area);
    }

    void setListener(TiliListener listener){
        this.listener=listener;
        listener.setText1(textField1);
        listener.setText2(textField2);
        listener.setlist(list);
        listener.setText3(area);
        textField1.addActionListener(listener);
        textField2.addActionListener(listener);

        button1.addActionListener(listener);

    }
    void setshuchu(Shuchu shuchu){
        this.shuchu=shuchu;
        shuchu.setlist(list);
        shuchu.setText3(area);
        button2.addActionListener(shuchu);
    }

}
